package com.lifo.utils.queue;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * Created by Administrator on 2018/5/19 0019.
 */
@Configuration
public class ThreadPoolConfig {
    @Bean("taskThreadPool")
    public ThreadPoolExecutor taskThreadPool () {
        return new ThreadPoolExecutor(10, 30, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(300), new ThreadPoolExecutor.CallerRunsPolicy());
    }
}
